var JA = JA || {};

/*判断变量是否为空*/
JA.empty = function(v){
    switch (typeof v){
        case 'undefined' : return true;
        case 'string' : if($.trim(v).length == 0) return true; break;
        case 'boolean' : if(!v) return true; break;
        case 'number' : if(0 === v) return true; break;
        case 'object' :
            if(null === v) return true;
            if(undefined !== v.length && v.length==0) return true;
            for(var k in v){return false;} return true;
            break;
    }
    return false;
};
/*毫秒转换为时间格式*/
JA.msToDate = function(v){
    var date = new Date(v);
    var YY = date.getFullYear() + '-';
    var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
    var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
    var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
    var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
    return YY + MM + DD +" "+hh + mm + ss;
}
/*手机号脱敏*/
JA.mobileDst = function(v){
    var reg = /^(\d{3})\d{4}(\d{4})$/;
    return v.replace(reg, "$1****$2");
}